package com.homework.oop;

import java.util.Scanner;

public class Guess {
  private int v = 100;
  Scanner sc = new Scanner(System.in);

  public void guess() {
    System.out.print("请输入你猜的数字：");
    int num = sc.nextInt();
    if (this.v > num) {
      System.out.println("小了");
      guess();
    } else if (num > this.v) {
      System.out.println("大了");
      guess();
    }else {
      System.out.println("恭喜你，答对了");
    }
  }

  public static void main(String[] args) {
    Guess g  = new Guess();
    g.guess();
  }
}
